package org.coldlife.sim.grav;

import javax.vecmath.Point3d;
import javax.vecmath.Tuple3d;
import javax.vecmath.Vector3d;

public class RandomPositionFactory extends ParticleFactory
{
	private Tuple3d minPos = new Point3d(0,0,0);
	private Tuple3d maxPos = new Point3d(640,480,40);
	
	private double mass;
	
	public RandomPositionFactory(double mass) 
	{
		this.mass = mass;
	}
	
	@Override
	public MassParitcle create()
	{
		MassParitcle p = super.create();
		double posx = Math.random() * maxPos.x + minPos.x;
		double posy = Math.random() * maxPos.y + minPos.y;
		double posz = Math.random() * maxPos.z + minPos.z;

		p.setMass(mass);
		p.setPosition(new Vector3d(posx,posy,posz));
		
		return p;
	}

	public Tuple3d getMinPos() {
		return minPos;
	}

	public void setMinPos(Tuple3d minPos) {
		this.minPos = minPos;
	}

	public Tuple3d getMaxPos() {
		return maxPos;
	}

	public void setMaxPos(Tuple3d maxPos) {
		this.maxPos = maxPos;
	}
}
